#include<iostream>
#include <queue>
using namespace std;
typedef struct node {
	int data;
	node* left;
	node* right;
	node(int data) :data(data),left(NULL),right(NULL){
}
}tree;
bool chack(tree* l, tree* r)
{
	if (!l && !r)return true;
	if (!l || !r)return false;
	if (l->data == r->data)
	{
		return chack(l->left, r->right) && (chack(l->right, r->left));
	}
}

bool issymmy(tree*&t)
{
	bool f=false;
	if (t)
	{
		return chack(t->left, t->right);
	}

}
bool issymmy2(tree*t)
{
	queue<tree*>pre;
	queue<tree*>poi;
	if (!t)return false;
	if (t->left && t->right)
	{
		pre.push(t->left);
		poi.push(t->right);
	}
	while (!pre.empty()&&!poi.empty())
	{
		int size1 = pre.size();
		int size2 = pre.size();
		if (size1 != size2)return false;
		tree* tl = pre.front();
		tree* tr = poi.front();
		pre.pop(), poi.pop();
		if (tl->data != tr->data)
		{
			return false;
		}
		for (int i = 0; i < size1; i++)
		{
			pre.push(tl->left);
			poi.push(tr->right);
			pre.push(tl->right);
			poi.push(tr->left);
		}

	}
	return true;

}
int main()
{

}